

import java.util.Vector;
import java.awt.Graphics;
import java.awt.Point;

import javax.swing.ImageIcon;


//@SuppressWarnings("unused")
public class Chip implements WorkspaceObj{
	private Vector<ChipPin> inputs;
	private Vector<ChipPin> outputs;
	private String name;
	private Point location;
	private ImageIcon img;
	
	
	/**
	 * Draws the chip to the given graphics context.
	 * @param g the graphics context to draw the chip to.
	 */
	public void draw(Graphics g){
		img.paintIcon(null, g, location.x, location.y);
	}
	
	
	/**
	 * 'Moves' the chip to a new location.
	 * @param loc (Point) contains the new (x,y) coordinates of the chip.
	 */
	public void move(Point loc){
		location = loc;
	}
	
	
	/**
	 * Removes the chip from the workspace by disconnecting it from all wires.
	 */
	public void remove(){
		//Fill this out. Needs to use disconnect on all of the
		//appropriate wires.
	}
	
	
	/**
	 * Attaches a wire to an input. Maybe add another method that
	 * includes the index of the desired input.
	 * @param pinIn is the WirePin to connect our input to.
	 * @return false on fail to connect.
	 */
	public boolean attachInput(WirePin pinIn){
		return false;
	}
	
	
	/**
	 * Attaches a wire to an output. Maybe add another method that
	 * includes the index of the desired output.
	 * @param pinOut is the WirePin to connect our output to.
	 * @return false on fail to connect.
	 */
	public boolean attachOutput(WirePin pinOut){
		return false;
	}
	
	
	/**
	 * Sets the 'name' of the Chip.
	 * @param chipName (String) is the desired name.
	 */
	public void setName(String chipName){
		name = chipName;
	}
	
	
	/**
	 * Returns the 'name' of the Chip.
	 * @return the 'name' of the Chip.
	 */
	public String getName(){
		return name;
	}
	
	
	////////////////////////////////////////////////////////////////////////
	/**
	 * Draws each of the wire's lines to the given graphics context
	 * @param g the graphics context to draw the wire to.
	 */
	public Chip(String imgpth, Vector<ChipPin> pinsIn, Vector<ChipPin> pinsOut){
		img = new ImageIcon(imgpth);
		inputs = pinsIn;
		outputs = pinsOut;
		location = new Point(0,0);
	}
	/////////////////////////////////////////////////////////////////////////
	
	
	/**
	 * Checks to see if the parameter 'other' (Pin) is connected to any
	 * inputs or outputs of this chip. 
	 * @param other is a Pin to check for connectedness with this chip.
	 * @return a boolean with value true if 'other' is connected to the chip,
	 * else false.
	 */
	@Override
	public boolean isConnected(Pin other) {
		// TODO Auto-generated method stub
		return false;
	}
	
	
	/**
	 * Attaches ourPin to theirPin.
	 * @param ourPin, theirPin (Pin). These are pins to connect to each other.
	 * @return a boolean with value true if ourPin successfully connects
	 * to theirPin, else false.
	 */
	@Override
	public Boolean attachTo(Pin ourPin, Pin theirPin) {
		// TODO Auto-generated method stub
		return false;
	}
	
	
	/**
	 * Draws each of the wire's lines to the given graphics context
	 * @param g the graphics context to draw the wire to.
	 */
	@Override
	public Boolean detachFrom(Pin ourPin, Pin theirPin) {
		// TODO Auto-generated method stub
		return null;
	}
	
	
	/**
	 * Draws each of the wire's lines to the given graphics context
	 * @param g the graphics context to draw the wire to.
	 */
	@Override
	public void select() {
		// TODO Auto-generated method stub
		
	}
	
	
	/**
	 * Draws each of the wire's lines to the given graphics context
	 * @param g the graphics context to draw the wire to.
	 */
	@Override
	public void deselect() {
		// TODO Auto-generated method stub
		
	}
}